package com.esd.db.dao;

import java.util.List;
import java.util.Map;

import com.esd.db.model.task;
import com.esd.db.model.taskWithBLOBs;

public interface taskMapper {
	
	int selectTaskCountByPackIdAndTaskStatus(Map<String, Object> map);
	
	List<task> selectLikeTaskName(Map<String, Object> map);

    int deleteByPrimaryKey(Integer taskId);
    
    int deleteByPackId(Integer packId);

    int insert(taskWithBLOBs record);

    int insertSelective(taskWithBLOBs record);

    taskWithBLOBs selectByPrimaryKey(Integer taskId);
    
    List<task> selectAllTaskId();
    
    List<task> selectAllDoingTaskByWorkerId(Integer workerId);
    
    List<task> selectAllHistoryTaskByWorkerId(Integer workerId);
    
    List<task> selectAllTaskByPackId(Integer packId);
	//worker下载任务
    List<taskWithBLOBs>  selectTaskOrderByTaskLvl(Map<String, Object> map);
    
    int updateWorkerIdDowningTask(Map<String, Object> map);

	List<taskWithBLOBs> selectTaskbyWorkerIdTaskUpload(Map<String, Object> map);
    //-------------------------------------------------------------------------
    int updateByPrimaryKeySelective(taskWithBLOBs record);
    
    int updateDownTaskByTaskId(taskWithBLOBs record);

    int updateByPrimaryKeyWithBLOBs(taskWithBLOBs record);

    int updateByPrimaryKey(task record);
    
    int updateByPackId(task task);
    
    int updateByWorkerId(Map<String, Object> map);
    
    int updateByLimit(Map<String, Object> map);
    
    int selectUndoTaskCount();
    
    int selectFirstPackIdOrderByTaskLvl();
    
    int selectUndoTaskCountByPackId(Map<String,Object> map);
    
    List<taskWithBLOBs> selectTaskByTaskName(String taskName);
    
    int selectTaskCountByPackId(Integer packId);
    
    int selectDoingTaskCountByPackId(Integer packId);
    
    int selectFinishTaskCountByPackId(Integer packId);
    
    List<taskWithBLOBs> selectFinishTaskByPackId(Integer packId);
    
    String selectTaskDirByTaskId(Integer taskId);
    
    List<taskWithBLOBs> selectDoingTaskByWorkerId(Integer workerId);
    
    List<task> selectAllTaskPagesByPackId(Map<String, Integer> map);
    
    List<task> selectDoingTaskPagesByPackId(Map<String, Integer> map);
    
    List<task> selectFinishTaskPagesByPackId(Map<String, Integer> map);
    
    int selectFreePackCount();
    
    int updateByTaskId(task task);
    
	int selectTaskLvlByPackId(int packId);
	
	int selectWorkerIdZeroCountByPackId(Map<String, Object> map);
	
	int updateAduitByWorkerId(Map<String, Object> map);
	
	int updateFileByTaskId(Map<String, Object> map);
	//回收任务
	int updateWorkerIdByWorkerId(Map<String, Object> map);
		
	int updateByWorkerIdAndTaskUpload(Map<String, Object> map);
	
	int updateAduitForInspectByDay(Map<String, Object> map);

	int updateAduitForInspectByPackage(Map<String, Object> map);

	int updateInspUseridByTaskId(Map<String, Object> map);

	int updateAduitByWorkerIdForInspByUser(Map<String, Object> map);

	int updateAduitForInspectByDayIsUnqualified(Map<String, Object> map);

	int updateAduitForInspectByPackageIsUnqualified(Map<String, Object> map);

	int updateAduitForQuickInspectionIsUnqualified(Map<String, Object> map);
	
	/**
	 * 不合格超过两次释放任务  ---批量更新Task信息
	 * @param taskIds  task表的id  List
	 * @return  更新条数
	 */
	int updateTaskForReleaseTaskByTaskIds(List<Integer> taskIds);
	
	/**
	 * 审核修改textgrid用
	 * @param taskWithBLOBs
	 * @return
	 */
	int updateModifyTask(taskWithBLOBs taskWithBLOBs);

	List<taskWithBLOBs> selectTaskWithBLOBsByTaskIds(Map<String, Object> map);
	
	taskWithBLOBs selectTaskForInspDownloadByTaskId(Integer taskId);
	
	/**
	 * 根据taskid 更新初审有效时间是零的任务
	 * @param taskIds
	 * @return
	 */
	int updateTaskForFirstInspectionMarkTimeIsZeroByTaskIds(Map<String, Object> map);

	List<taskWithBLOBs> selectFinishTaskByDateCondition(Map<String, Object> map);

	List<taskWithBLOBs> selectFinishTaskByPackIds(Map<String, Object> map);
}